package com.baosight.sczx.zm.ca.service;

import java.util.Calendar;

import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.Utils;
import com.baosight.sczx.zm.ca.domain.VZMCA12;

public class ServiceZMCA12 extends ServiceEPBase{
	/**
	 * 页面初始化，返回组织好的层级小代码
	 * 
	 * @param EiInfo
	 * @return EiInfo
	 */
	public EiInfo initLoad(EiInfo inInfo) {
		return inInfo;//return this.query(inInfo);
	}

	public EiInfo queryByIndex(EiInfo inInfo) {
		VZMCA12 m = new VZMCA12();
		EiInfo outInfo = super.query(inInfo, "ZMCA12.queryByIndex", m);	
		outInfo.addBlock(Utils.generateOutBlock("queryByDepartment", m, inInfo, "ZMCA12.queryIndexByDepartment", false));
		return outInfo;
	}
	
	/**
	 * 查询未处理的隐患和三违
	 * 
	 * @param EiInfo
	 * @return EiInfo
	 */
	public EiInfo queryUnHandleRiskAndDeregulation(EiInfo inInfo) {
		VZMCA12 m = new VZMCA12();
		EiInfo outInfo = super.query(inInfo, "ZMCA12.queryUnHandleRiskAndDeregulation", m);	
		return outInfo;
	}
	
	public EiInfo queryByChart(EiInfo inInfo) {
		VZMCA12 m = new VZMCA12();
		inInfo.addBlock(Utils.generateOutBlock("queryByYear", m, inInfo, "ZMCA12.queryByYear", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByYearLevel", m, inInfo, "ZMCA12.queryByYearL", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByYearClassify", m, inInfo, "ZMCA12.queryByYearC", false));

		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH)+1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;
	}
	
	public EiInfo queryByListView(EiInfo inInfo) {
		VZMCA12 m = new VZMCA12();
		inInfo.addBlock(Utils.generateOutBlock("queryByYear", m, inInfo, "ZMCA12.queryByYearYes2", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByYearR", m, inInfo, "ZMCA12.queryByYearYes2R", false));
				
		inInfo.addBlock(Utils.generateOutBlock("queryByPlace", m, inInfo, "ZMCA12.queryByPlace", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByPlaceR", m, inInfo, "ZMCA12.queryByPlaceR", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByDepartment", m, inInfo, "ZMCA12.queryByDepartment", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByDepartmentR", m, inInfo, "ZMCA12.queryByDepartmentR", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByListL", m, inInfo, "ZMCA12.queryByListL", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByListLR", m, inInfo, "ZMCA12.queryByListLR", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByListC", m, inInfo, "ZMCA12.queryByListC", false));
		inInfo.addBlock(Utils.generateOutBlock("queryByListCR", m, inInfo, "ZMCA12.queryByListCR", false));
		
		Calendar currentTime = Calendar.getInstance(); 
		inInfo.set("month", ""+(currentTime.get(Calendar.MONTH)+1));
		inInfo.set("year", ""+currentTime.get(Calendar.YEAR));
		return inInfo;
	}
}
